package csc.daonjpa.java.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import csc.daonjpa.java.dao.CustomerDAO;
import csc.daonjpa.java.domain.Customer;

@Service
public class CustomerService {
	@Autowired
	private CustomerDAO customerDAO;

	/**
	 * @return the customerDAO
	 */
	public CustomerDAO getCustomerDAO() {
		return customerDAO;
	}

	/**
	 * @param customerDAO the customerDAO to set
	 */
	public void setCustomerDAO(CustomerDAO customerDAO) {
		this.customerDAO = customerDAO;
	}
	
	public Customer checkLogin(String id, String pass){
		return customerDAO.checkLogin(id, pass);
	}
	
	public boolean updatePassWord(Long customerId, String oldPass, String newPass){
		return customerDAO.updatePassWord(customerId, oldPass, newPass);
	}
	
	public Customer getCustomer(Long id) {
		return customerDAO.getCustomerByCustomerId(id);
	}
	
	public void resetFailedCount(Long loginId){
		customerDAO.resetFailedCount(loginId);
	}
	
	public Customer getCustomerByLoginId(String loginId){
		return customerDAO.getCustomerByLoginId(loginId);
	}
	
	public void updateFailedCount(Customer customer){
		customerDAO.updateFailedCount(customer);
	}
	
	public Customer getCustomerByAccountNumber(String accountNumber) {
		return customerDAO.getCustomerByAccountNumber(accountNumber);
	}
}
